if(CMAKE_VERSION VERSION_GREATER 3.20 AND CMAKE_C_BYTE_ORDER EQUAL LITTLE_ENDIAN)
  set(CMAKE_BYTE_ORDER 1234)
elseif(CMAKE_VERSION VERSION_GREATER 3.20 AND CMAKE_C_BYTE_ORDER EQUAL BIG_ENDIAN)
  set(CMAKE_BYTE_ORDER 4321)
else()
  include(TestBigEndian)
  test_big_endian(TEST_BIG_ENDIAN)
  if(TEST_BIG_ENDIAN)
    set(CMAKE_BYTE_ORDER 4321)
  else()
    set(CMAKE_BYTE_ORDER 1234)
  endif()
endif()
